#ifndef CUSTOMWIDGET_H
#define CUSTOMWIDGET_H

#include <QWidget>
#include <QDialog>
#include <QMutex>
#include <QTimer>

#include <QLineEdit>
#include<QEvent>
#include<QMouseEvent>
#include<QPaintEvent>

QT_BEGIN_NAMESPACE
class QPushButton;
class QLabel;
class QLineEdit;
class QHBoxLayout;
class QVBoxLayout;
QT_END_NAMESPACE
//没有它 → 样式表可能不工作

//有它 → 样式表正常显示

//它是自定义控件显示样式的"钥匙"
class CustomWidget : public QWidget
{
    Q_OBJECT
public:
    explicit CustomWidget(QWidget *parent = 0);

signals:

public slots:

protected:
    void paintEvent(QPaintEvent *);
};

class CustomMoveWidget : public CustomWidget {
    Q_OBJECT
public:
    explicit CustomMoveWidget(QWidget *parent = 0);
    ~CustomMoveWidget();

protected:
    QPoint mousePoint;      // 存储鼠标在窗口内的相对位置
    bool m_mousePressed;    // 标记鼠标是否按下

    void mouseMoveEvent(QMouseEvent *e);
    void mousePressEvent(QMouseEvent *e);
    void mouseReleaseEvent(QMouseEvent *);
};

#endif // CUSTOMWIDGET_H
